#!/usr/local/bin/python3
# -*- coding: utf-8 -*-

"""
@File    :tutorial_2.py
@Author  :keyin
@Time    :2021-02-02 17:00
"""

import cv2 as cv
import numpy as np

def access_pixels(image):
    print(image.shape)
    height = image.shape[0]
    width = image.shape[1]
    channels = image.shape[2]  # 通道数
    print('高:',height, '       ', '宽:', width, '        ', '通道:', channels)
    for row in range(height):
        for col in range(width):
            for c in range(channels):
                pv = image[row, col, c]
                image[row, col, c] = 255 - pv
    cv.imshow('pixels_demo', image)

def creat_image():
    # img = np.zeros([400, 400, 3], np.uint8)
    #
    # img[:, :, 2]=np.ones([400, 400])*255
    img = np.ones([400, 400, 1], np.uint8)
    print(img)
    img = img * 0
    print(img)

    cv.imshow(' ', img)


if __name__ == '__main__':


    print('-----------------------Hello Python-----------------------')
    src = cv.imread('6.png')
    # cv.namedWindow("input_image", cv.WINDOW_AUTOSIZE)
    # cv.imshow('input image', src)
    # access_pixels(src)
    creat_image()
    cv.waitKeyEx(0)
    cv.destroyAllWindows()